package view.rules;

import java.awt.Dimension;
import java.awt.Toolkit;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.io.File;

import javax.swing.JComboBox;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.JButton;

import ruletree.rule.Rule;

import net.miginfocom.swing.MigLayout;

public class SubmitPanel extends JPanel{
	
	private JLabel refLabel;
	private JComboBox refCombo;
	private JButton topicButton;
	private JComboBox topicCombo;
	public JButton okButton;
	public JButton cancelButton;
	
	private Rule rule;
	private File file;
	
	public SubmitPanel(){
		setLayout(new MigLayout());
		initComponent();
		addComponent();
	}
	
	private void initComponent(){
		
		Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize();
		
		refLabel = new JLabel("References");
		refCombo = new JComboBox();
		refCombo.setMinimumSize(new Dimension(350, 20));
		topicButton = new JButton("Topics");
		topicCombo = new JComboBox();
		topicCombo.setMinimumSize(new Dimension(350, 20));
		okButton = new JButton("OK");
		cancelButton = new JButton("Cancel");
		
		
	}
	
	private void addComponent(){
		
		add(refLabel);
		add(refCombo);
		add(topicButton);
		add(topicCombo);
		add(okButton);
		add(cancelButton);
		
	}

	
	public void setRule(Rule rule, File file){
		this.rule = rule;
		this.file = file;
	}
	
	
	class btnSaveListener implements ActionListener {

		@Override
		public void actionPerformed(ActionEvent arg0) {
			rule.saveRule(file);
			
		}
		
	}


}
